﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xww.IO;

namespace Xww.LCV.Generator {
    public abstract class BaseGenerator : ILCSGenerator {
        #region ILCSGenerator 成员

        public abstract LCSCollection FromStrings(IEnumerable<string> lines, MiningParam param);

        public virtual LCSCollection FromFile(string fileName, MiningParam param) {
            return FromStrings(fileName.ReadAllLines().ToArray(), param);
        }
        public EventHandler<Xww.Task.ProgressStatus> OnStepChange { get; set; }

        #endregion

        public static readonly string AminoAcidString = "ACDEFGHIKLMNPQRSTVWY";
        protected Dictionary<char, int> CreateEmptyAACounter() {
            Dictionary<char, int> rst = new Dictionary<char, int>(AminoAcidString.Length);
            for (int i = 0; i < AminoAcidString.Length; i++) {
                rst.Add(AminoAcidString[i], 0);
            }
            return rst;
        }
        public void StepChange(Xww.Task.ProgressStatus e) {
            if (OnStepChange != null)
                OnStepChange(this, e);
        }


    }
}
